<template>
    <view class="tabbar">
        <view class="tabbar-box" @mouseover="onBarMouseOver" @mouseout="onBarMoueOut">
            <view class="tabbar-top">
                <view class="logo-img" @click="goSetting">
                    <image :src="headImgUrl" mode="aspectFill" @error="onImgError"></image>
                </view>
                <div class="box-type comm-list" id="box-type-box">
                    <!-- begin  -->
                    <!-- 会员 -->
                    <view class="item" v-for="(item, index) in vipList" :key="item.id" @click="goPath(item)"
                        :class="tabIndex == item.id ? 'active' : ''" v-if="item.access">
                        <view class="i-icon">
                            <image :src="tabIndex == item.id
                                ? item.iconOnPath
                                : item.iconPath
                                "></image>
                        </view>
                        <view class="type-txt" :class="{ 'type-txt-s': tabIndex == item.id }">{{ item.title }}</view>
                    </view>
                    <!-- 预约 -->
                    <view class="item" v-for="(item, index) in subscribeList" :key="item.id" @click="goPath(item)"
                        :class="tabIndex == item.id ? 'active' : ''" v-if="item.access">
                        <view class="i-icon">
                            <image :src="tabIndex == item.id
                                ? item.iconOnPath
                                : item.iconPath
                                "></image>
                        </view>
                        <view class="type-txt" :class="{ 'type-txt-s': tabIndex == item.id }">{{ item.title }}</view>
                    </view>
                    <!-- 新开单 -->
                    <view class="item" v-for="(item, index) in billingList" :key="item.id" @click="goPath(item)"
                        :class="tabIndex == item.id ? 'active' : ''" v-if="item.access">
                        <view class="i-icon">
                            <image :src="tabIndex == item.id
                                ? item.iconOnPath
                                : item.iconPath
                                "></image>
                        </view>
                        <view class="type-txt" :class="{ 'type-txt-s': tabIndex == item.id }">{{ item.title }}</view>
                    </view>
                    <!-- 订单 -->
                    <view class="item" v-for="(item, index) in documentList" :key="item.id" @click="goPath(item)"
                        :class="tabIndex == item.id ? 'active' : ''" v-if="item.access">
                        <view class="i-icon">
                            <image :src="tabIndex == item.id
                                ? item.iconOnPath
                                : item.iconPath
                                "></image>
                        </view>
                        <view class="type-txt" :class="{ 'type-txt-s': tabIndex == item.id }">{{ item.title }}</view>
                    </view>
                    <!-- end -->

                    <!-- 商品 -->
                    <view class="item" v-for="(item, index) in tabBarList" :key="item.id" @click="goPath(item)"
                        :class="tabIndex == item.id ? 'active' : ''" v-if="item.access">
                        <view class="i-icon">
                            <image :src="tabIndex == item.id
                                ? item.iconOnPath
                                : item.iconPath
                                "></image>
                        </view>
                        <view class="type-txt" :class="{ 'type-txt-s': tabIndex == item.id }">{{ item.title }}</view>
                    </view>

                    <!-- 采购 -->
                    <view class="item" v-for="(item, index) in tabBarPuschList" :key="item.id" @click="goPath(item)"
                        :class="tabIndex == item.id ? 'active' : ''" v-if="item.access">
                        <view class="i-icon">
                            <image :src="tabIndex == item.id
                                ? item.iconOnPath
                                : item.iconPath
                                "></image>
                        </view>
                        <view class="type-txt" :class="{ 'type-txt-s': tabIndex == item.id }">{{ item.title }}</view>
                    </view>

                    <!-- 预约 -->
                    <view class="item" v-for="(item, index) in tabBarAboutList" :key="item.id" @click="goPath(item)"
                        :class="tabIndex == item.id ? 'active' : ''" v-if="item.access">
                        <view class="i-icon">
                            <image :src="tabIndex == item.id
                                ? item.iconOnPath
                                : item.iconPath
                                "></image>
                        </view>
                        <view class="type-txt" :class="{ 'type-txt-s': tabIndex == item.id }">{{ item.title }}</view>
                    </view>

                    <!-- 库管 -->
                    <view class="item" v-for="(item, index) in tabBarWarehouseManageList" :key="item.id"
                        @click="goPath(item)" :class="tabIndex == item.id ? 'active' : ''" v-if="item.access">
                        <view class="i-icon">
                            <image :src="tabIndex == item.id
                                ? item.iconOnPath
                                : item.iconPath
                                "></image>
                        </view>
                        <view class="type-txt" :class="{ 'type-txt-s': tabIndex == item.id }"> {{ item.title }} </view>
                    </view>

                    <!-- 设备 -->
                    <view class="item" v-for="(item, index) in tabBarDeviceList" :key="item.id" @click="goPath(item)"
                        :class="tabIndex == item.id ? 'active' : ''" v-if="item.access">
                        <view class="i-icon">
                            <image :src="tabIndex == item.id
                                ? item.iconOnPath
                                : item.iconPath
                                "></image>
                        </view>
                        <view class="type-txt" :class="{ 'type-txt-s': tabIndex == item.id }">{{ item.title }}</view>
                    </view>

                    <!--  2025-04-06 营销 -->
                    <view class="item" v-for="(item, index) in tabMarketingList" :key="item.id" @click="goPath(item)"
                        :class="tabIndex == item.id ? 'active' : ''" v-if="item.access">
                        <view class="i-icon">
                            <image :src="tabIndex == item.id
                                ? item.iconOnPath
                                : item.iconPath
                                "></image>
                        </view>
                        <view class="type-txt" :class="{ 'type-txt-s': tabIndex == item.id }">{{ item.title }}</view>
                    </view>

                    <!-- 互动 -->
                    <!-- <view class="item" v-for="(item, index) in tabBarInteractionList" :key="item.id"
                        @click="goPath(item)" :class="tabIndex == item.id ? 'active' : ''" v-if="item.access">
                        <view class="i-icon">
                            <image :src="tabIndex == item.id
                                ? item.iconOnPath
                                : item.iconPath
                                "></image>
                        </view>
                        <view class="type-txt" :class="{ 'type-txt-s': tabIndex == item.id }">{{ item.title }}</view>
                    </view> -->

                    <!-- 同城商圈 -->
                    <!-- <view
                        class="item"
                        v-for="(item, index) in tabBarLocalbusiness"
                        :key="item.id"
                        @click="goPath(item)"
                        :class="tabIndex == item.id ? 'active' : ''"
                        v-if="item.access"
                    >
                        <view class="i-icon">
                            <image
                                :src="
                                    tabIndex == item.id
                                        ? item.iconOnPath
                                        : item.iconPath
                                "
                            ></image>
                        </view>
                        <view
                            class="type-txt"
                            :class="{ 'type-txt-s': tabIndex == item.id }"
                            >{{ item.title }}</view
                        >
                    </view> -->

                    <!-- 财务 -->
                    <view class="item" v-for="(item, index) in financeList" :key="item.id" @click="goPath(item)"
                        :class="tabIndex == item.id ? 'active' : ''" v-if="item.access">
                        <view class="i-icon">
                            <image :src="tabIndex == item.id
                                ? item.iconOnPath
                                : item.iconPath
                                "></image>
                        </view>
                        <view class="type-txt" :class="{ 'type-txt-s': tabIndex == item.id }">{{ item.title }}</view>
                    </view>

                    <!-- 报表 -->
                    <view class="item" v-for="(item, index) in tabBarReportList" :key="item.id" @click="goPath(item)"
                        :class="tabIndex == item.id ? 'active' : ''" v-if="item.access">
                        <view class="i-icon">
                            <image :src="tabIndex == item.id
                                ? item.iconOnPath
                                : item.iconPath
                                "></image>
                        </view>
                        <view class="type-txt" :class="{ 'type-txt-s': tabIndex == item.id }">{{ item.title }}</view>
                    </view>
                </div>
            </view>
            <!-- 设置 -->
            <view class="tabber-set">
                <view class="item" v-for="(item, index) in tabBarBtmList" @mouseover="onMouseover($event, item)"
                    @mouseout="onMouseOut($event, item)" :key="index" @click="openSetWin(item)">
                    <view class="i-icon">
                        <image :src="item.iconPath"></image>
                    </view>
                </view>
            </view>
        </view>
        <view class="c-list" v-if="tabIndex && isLeftShow">
            <view class="group-title">{{ sTitleTxt }}</view>
            <view class="divider"></view>
            <view class="item" v-for="(item, index) in secondList" :key="index" v-if="item.access">
                <view class="i-tit" :class="{ 'i-tit-act': curSecondId == item.id && curThirdId == -1 }"
                    @click.stop="handleMenuClick(item, null)">
                    {{ item.title }}
                </view>
                <view class="third-list" v-if="item.list && item.list.length">
                    <view class="item-s" v-for="(third, idx) in item.list" :key="idx"
                        :class="{ 'item-s-act': curSecondId == item.id && curThirdId == third.id }"
                        @click.stop="handleMenuClick(item, third)" v-if="third.access">
                        {{ third.title }}
                    </view>
                </view>
            </view>
        </view>
        <tipTxt ref="tipTxt"></tipTxt>
        <view class="arrow-box" v-if="showArrowBtn && tabIndex && secondList.length != 1">
            <view v-if="expander">
                <view class="a-b-com a-b-r" @click="expand()">
                    <text class="icon-font arrow">&#xe604;</text>
                </view>
            </view>
            <view v-else>
                <view class="a-b-com a-b-l" @click="expand()" :style="'opacity: ' + lOpactiy + ';'"
                    @mouseover="onBarMouseOver">
                    <text class="icon-font arrow">&#xe600;</text>
                </view>
            </view>
        </view>
        <sysMenu ref="sysMenu" @showTabnar="showTabnar"></sysMenu>
    </view>
</template>

<script>
import staticConst from "@/js/const/StaticConst.js"; // 权限id 
import accessCtrl from "@/js/limit/AccessCtrl.js"; // 检测权限

import DEFAULT_IMG from "@/static/images/Uimg.png";
import goPage from "@/js/GoPage.js";
import localStore from "@/js/LocalStore.js";

import lang from "@/js/conf/Lang.js";

import tipTxt from "@/components/comm/TipTxt.vue";

import sysMenu from "@/components/comm/SysMenuNew.vue";

import config from "@/js/conf/Config.js";

import { mapGetters } from "vuex";

export default {
    computed: {
        ...mapGetters(["hasLogin", "isExpand", "tabBarIds"]),
    },
    components: {
        tipTxt,
        sysMenu,
    },
    data() {
        return {
            isLeftShow: false,
            tabIndex: '',//staticConst.ORDER_XS,
            tabBarBtmList: [
                {
                    type: "sz",
                    id: 1,
                    title: "设置",
                    icon: "icon-shezhi",
                    iconOnPath: "/static/images/menuOn05.png",
                    iconPath: "/static/images/menu05.png",
                    path: "/pages/index/index",
                },
            ],
            defaultImg: DEFAULT_IMG,
            tabBarList: [],
            info: {},
            headImgUrl: "",
            setTout: false,
            saleTxt: lang.saleTxt,
            purchcaseTxt: lang.purchcaseTxt,
            aboutTxt: lang.aboutSTxt,
            marketingTxt: lang.marketingTxt,
            tabBarPuschList: [],
            purchLimit: false,
            aboutLimit: false,
            marketingLimit: false,
            repLimit: false,
            repTxt: lang.repTxt,
            tabBarReportList: [],
            tabBarWarehouseManageList: [],
            tabBarAboutList: [],
            tabMarketingList: [],
            tabBarInteractionList: [],
            tabBarLocalbusiness: [],
            financeList: [], // 财务
            sTitleTxt: "",
            secondList: [],
            curSecondId: -1,
            curThirdId: -1,

            marketingList: [], // 营销
            showArrowBtn: false,
            expander: true,
            lOpactiy: 0,
            urlData: {}, //url的参数
            locaTabBarIds: {},

            // 新侧边栏
            vipList: [], // 会员
            subscribeList: [], //预约
            billingList: [], // 开单
            documentList: [], // 订单

            activeSecondIndex: null,

            // 设备
            tabBarDeviceList: [],
        };
    },

    onLoad() { },

    async mounted() {
        await this.initData();
        // 默认展开第一个二级菜单
        if (this.secondList && this.secondList.length > 0) {
            this.activeSecondIndex = 0;
            this.curSecondId = this.secondList[0].id;
            if (this.secondList[0].list && this.secondList[0].list.length > 0) {
                this.curThirdId = this.secondList[0].list[0].id;
            }
        }
        uni.$on("reset_tabbar_i", (data) => {
            this.resetDataIndex(data);
        });

        uni.$on("reset_tabbar_data", () => {
            this.resetData();
        });

        uni.$on("write_bill", (data) => {
            this.bill(data);
        });

        uni.$on("write_project_bill", () => {
            this.projectBill();
        });

        uni.$on("project_customer", (data) => {
            this.projectCustomer(data);
        });

        this.syncMenuActiveByRoute();
        // 监听路由变化
        this.$watch && this.$watch('$route', this.syncMenuActiveByRoute);
    },

    created() {
        this.urlData = this.$geturl();
    },

    methods: {
        async initData() {
            this.tabIndex = "";
            uni.setLeftWindowStyle({ width: "72px" }); //设置左边导航宽度
            this.lOpactiy = 0;

            // this.tabIndex = staticConst.ORDER_XS;
            this.locaTabBarIds = localStore.getTabBarIds();
            this.loadUinfoData();
            this.purchLimit = await accessCtrl.getPurchLimit();
            this.repLimit = await accessCtrl.getLimitReprot();
            this.aboutLimit = await accessCtrl.getAboutLimit();
            this.marketingLimit = await accessCtrl.getMarketingLimit();
            this.expander = this.isExpand;
            this.setTabSollFun();
        },
        resetDataIndex(data) {
            console.log("123123", data);
            this.curSecondId = data.box_index;
            this.curThirdId = data.index;
        },
        showTabnar() {
            this.tabIndex = "";
            this.curSecondId = "";
            let data = {};
            data.tabIndex = "9999";
            data.curSecondId = "9999";
            data.curThirdId = "9999";
            this.$store.commit("setTabBarIds", data);
            uni.setLeftWindowStyle({ width: "72px" });
        },
        resetData() {
            this.initData();
            let data = {};
            data.tabIndex = '';

            // data.tabIndex = this.tabIndex = staticConst.ORDER_XS;
            data.curSecondId = this.curSecondId = -1;
            data.curThirdId = this.curThirdId = -1;
            // uni.setLeftWindowStyle({ display: "block", width: "240px" }); //设置左边导航宽度
            uni.setLeftWindowStyle({ display: "block", width: "72px" }); //设置左边导航宽度
            this.showArrowBtn = false;
            this.expander = true;
            this.$store.commit("setIsExpand", this.expander);
            this.init();
        },

        init() {
            let data = {};
            if (this.tabBarIds) {
                this.tabIndex = this.tabBarIds.tabIndex;
                if (this.tabIndex == 1) this.tabIndex = staticConst.ORDER_XS;
                this.curSecondId = this.tabBarIds.curSecondId;
                this.curThirdId = this.tabBarIds.curThirdId;
                if (this.locaTabBarIds.tabIndex == 9999) return;
                // this.tabIndex = "CW" // laizhe 加的 测试用
                if (this.tabIndex == staticConst.CW) {
                    // 财务
                    this.sTitleTxt = this.financeList[0].title;
                    this.secondList = this.financeList[0].list;
                } else if (this.tabIndex == staticConst.YX_PT) {
                    this.sTitleTxt = this.tabMarketingList[0].title;
                    this.secondList = this.tabMarketingList[0].list;
                } else if (this.tabIndex == staticConst.ORDER_XS) {
                    //销售
                    this.sTitleTxt = this.tabBarList[0].title;
                    this.secondList = this.tabBarList[0].list;
                    this.curSecondId = this.tabBarList[0].list[0].id;
                    this.curThirdId = -1;
                } else if (this.tabIndex == staticConst.ORDER_CG) {
                    //采购
                    this.sTitleTxt = this.tabBarPuschList[0].title;
                    this.secondList = this.tabBarPuschList[0].list;
                } else if (this.tabIndex == staticConst.YY_ADD_GOODS) {
                    //预约
                    this.sTitleTxt = this.tabBarAboutList[0].title;
                    this.secondList = this.tabBarAboutList[0].list;
                } else if (this.tabIndex == staticConst.HD_TAB) {
                    //互动
                    this.sTitleTxt = this.tabBarInteractionList[0].title;
                    this.secondList = this.tabBarInteractionList[0].list;
                } else if (this.tabIndex == staticConst.TCSQ_TAB) {
                    // 同城商圈
                    this.sTitleTxt = this.tabBarLocalbusiness[0].title;
                    this.secondList = this.tabBarLocalbusiness[0].list;
                    if (this.urlData.tab == 1) {
                        this.curThirdId = staticConst.TCSQ_BB_XX;
                    } else {
                        this.curThirdId = staticConst.TCSQ_BB_TJ;
                    }
                } else if (this.tabIndex == staticConst.REP_ALL) {
                    //报表
                    this.sTitleTxt = this.tabBarReportList[0].title;
                    this.secondList = this.tabBarReportList[0].list.map(vlist => {
                        if (vlist.access) {
                            return {
                                ...vlist
                            }
                        }
                    }).filter(v => v);
                } else if (this.tabIndex == accessCtrl.LIMIT_STOREKEEEPER) {
                    const validItem = this.tabBarWarehouseManageList.find(item => item.access);
                    if (validItem) {
                        this.sTitleTxt = validItem.title;
                        this.secondList = validItem.list;
                    } else {
                        this.sTitleTxt = '';
                        this.secondList = [];
                    }
                }
                else if (this.tabIndex == staticConst.DEV_DEVICE) {
                    //设备
                    this.sTitleTxt = this.tabBarDeviceList[0].title;
                    this.secondList = this.tabBarDeviceList[0].list;
                } else if (this.tabIndex == staticConst.MD_KH) {
                    // 新会员
                    this.sTitleTxt = this.vipList[0].title;
                    this.secondList = this.vipList[0].list;
                    this.$store.commit("setIsExpand", false);
                } else if (this.tabIndex == staticConst.YY_YY) {
                    // 新预约
                    this.sTitleTxt = this.subscribeList[0].title;
                    this.secondList = this.subscribeList[0].list;
                } else if (this.tabIndex == staticConst.MD_DJ) {
                    this.sTitleTxt = this.documentList[0].title;
                    this.secondList = this.documentList[0].list;
                } else if (this.tabIndex == staticConst.MD_KD) {
                    // 新开单
                    this.sTitleTxt = this.billingList[0].title;
                    this.secondList = this.billingList[0].list;
                }
                if (this.secondList.length == 1) {
                    this.isLeftShow = false;
                    uni.setLeftWindowStyle({ width: "72px" }); //设置左边导航宽度
                    this.expander = false;
                } else {
                    this.isLeftShow = true;
                    uni.setLeftWindowStyle({ width: "240px" }); //设置左边导航宽度
                    this.expander = true;
                }
                console.log('initData------xxxx------', this.secondList)
                let rt = this.$route;
                if (rt.path == '/pages/setting/index') {
                    uni.setLeftWindowStyle({ width: "72px" }); //设置左边导航宽度
                }
                this.showArrowBtn = true;
                this.$store.commit("setIsExpand", this.expander);
            }
            this.setLocalStore();
        },

        setLocalStore() {
            let data = {};
            data.tabIndex = this.tabIndex;
            data.curSecondId = this.curSecondId;
            data.curThirdId = this.curThirdId;
            this.$store.commit("setTabBarIds", data);
        },

        onBarMouseOver() {
            if (!this.showArrowBtn) return;
            if (this.expander) return;
            this.lOpactiy = 1;
        },

        onBarMoueOut() {
            if (!this.showArrowBtn) return;
            if (this.expander) return;
            this.lOpactiy = 0;
        },

        /****展开/收缩****/
        expand() {
            this.expander = !this.expander;
            if (!this.expander) {
                uni.setLeftWindowStyle({ width: "72px" }); //设置左边导航宽度
                this.lOpactiy = 0;
            } else {
                uni.setLeftWindowStyle({ width: "240px" }); //设置左边导航宽度
            }
            this.$store.commit("setIsExpand", this.expander);
        },

        setTabSollFun() {
            const arr = [8, 9, 10, 17, 19, 20];
            if (arr.indexOf(this.tabIndex) > -1) {
                setTimeout(() => {
                    document.querySelectorAll(
                        "#box-type-box"
                    )[0].scrollTop = 220;
                }, 300);
            }
        },

        actHandler(id) {
            let len = this.tabBarList.length;
            let item = null;
            for (let i = 0; i < len; i++) {
                let temp = this.tabBarList[i];
                if (temp.id == id) {
                    item = temp;
                    break;
                }
            }
            if (item) this.goPath(item);
        },

        /***采购***/
        actHandler1(id) {
            let len = this.tabBarPuschList.length;
            let item = null;
            for (let i = 0; i < len; i++) {
                let temp = this.tabBarPuschList[i];
                if (temp.id == id) {
                    item = temp;
                    break;
                }
            }
            if (item) this.goPath(item);
        },

        onImgError() {
            this.headImgUrl = this.defaultImg;
        },

        onMouseover(event, item) {
            let data = {};
            data.title = item.title;
            data.top = event.pageY + 20;
            if (item.type == "sz") {
                data.top = event.pageY - 40;
            }
            if (data.title.length == 2) {
                data.left = 16;
                data.width = 30;
            } else if (data.title.length == 3) {
                data.left = 12;
                data.width = 37;
            } else if (data.title.length == 4) {
                data.left = 6;
                data.width = 50;
            }
            data.display = "";
            this.$refs.tipTxt.showTip(data);
        },

        onMouseOut(item) {
            let data = {};
            data.display = "none";
            this.$refs.tipTxt.showTip(data);
        },

        async loadUinfoData() {
            this.info = await localStore.getUserInfo();
            if (this.info && this.info.avatar)
                this.headImgUrl = this.info.avatar;
            else this.headImgUrl = this.defaultImg;

            // 客户 会员
            this.vipList = [
                {
                    id: staticConst.MD_KH,
                    title: lang.memberTxt, //"vip",
                    iconOnPath: "/static/images/pc-icon-vip1.png",
                    iconPath: "/static/images/pc-icon-vip.png",
                    path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                    access:
                        (await accessCtrl.getSaleLimit()) ||
                        (await accessCtrl.getGoodsLimit()),
                    list: [
                        {
                            id: staticConst.MD_KH,
                            title: lang.customerTxt.titleTxt, //"客户",
                            path: "/pages/customer/index_v2",
                            access: await accessCtrl.getLimitSeeCustomer(),
                        },
                    ]
                }
            ];
            // 预约
            this.subscribeList = [
                {
                    id: accessCtrl.LIMIT_YY,
                    title: "预约", //预约
                    iconOnPath: "/static/images/home_appointment_appoint_s.png",
                    iconPath: "/static/images/home_appointment_appoint_n.png",
                    path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                    access: await accessCtrl.getyyLimit(),
                    list: [
                        {
                            id: staticConst.YY_YY_GL,
                            title: "预约概览", //预约
                            path: "/pages/appointOverview/index", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                            access: await accessCtrl.getyyBillLimit(),
                        },
                        {
                            id: staticConst.YY_YY_JL,
                            title: "预约记录", //预约
                            path: "/pages/appointment/index", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                            access: await accessCtrl.getyyBillLimit(),
                        },
                        {
                            id: staticConst.YY_YY_KHYY,
                            title: "客户预约", //预约
                            path: "/pages/customerAppoint/index", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                            access: await accessCtrl.getyyBillLimit(),
                        },
                        {
                            id: staticConst.YY_YY_YYPB,
                            title: "预约排班", //预约
                            path: "/pages/appointMake/index", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                            access: await accessCtrl.getyyBillLimit(),
                        },
                    ]
                    // list: [
                    //             {
                    //                 id: staticConst.YY_YY_KHYY,
                    //                 title: "客户预约",
                    //                 path: "/pages/customerAppoint/index",
                    //             },
                    //             {
                    //                 id: staticConst.YY_YY_YYPB,
                    //                 title: "预约排班",
                    //                 path: "",
                    //             },
                    //         ],
                }
            ];
            // 开单
            this.billingList = [
                {
                    // type: "xs",
                    id: staticConst.MD_KD,
                    // title: lang.receiptTxt.titleTxt,
                    title: "开单",
                    iconOnPath: "/static/images/pc-icon-kd1.png",
                    iconPath: "/static/images/pc-icon-kd.png",
                    path: "/pages/receipt/index",
                    access:
                        (await accessCtrl.getyyBillLimit()) ||
                        (await accessCtrl.getBillLimit()),
                    list: [
                        {
                            type: "xs",
                            id: staticConst.MD_KD,
                            // title: lang.receiptTxt.titleTxt,
                            title: "产品开单",
                            path: "/pages/receipt/index",
                            access:
                                (await accessCtrl.getSaleLimit()) &&
                                (await accessCtrl.getBillLimit()),
                        }, {
                            id: staticConst.YY_YY_KHKD,
                            title: "服务开单", //预约
                            path: "/pages/appointmentBilling/index", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                            access: await accessCtrl.getyyBillLimit(),
                        },
                    ]
                },
            ];
            // 订单
            this.documentList = [
                {
                    id: staticConst.MD_DJ,
                    title: "订单", //,
                    iconOnPath: "/static/images/pc-icon-order1.png",
                    iconPath: "/static/images/pc-icon-order.png",
                    path: "/pages/saleBills/index?tab=1", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                    access:
                        (await accessCtrl.getSaleLimit()) ||
                        (await accessCtrl.getPurchLimit()),
                    list: [
                        {
                            id: staticConst.MD_DJ,
                            // title: lang.billTxt.titleTxt,
                            title: "产品订单",
                            path: "/pages/saleBills/index?tab=1", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                            access: await accessCtrl.getSaleLimit(),
                        },
                        // {
                        //     id: staticConst.CG_DJ, //采购单据
                        //     // title: lang.billTxt.titleTxt,
                        //     title: "采购订单",
                        //     path: "/pages/purchBill/index?tab=2", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                        //     access: await accessCtrl.getPurchLimit(),
                        // },
                        {
                            id: staticConst.YY_DJ,
                            title: "服务订单", //单据
                            path: "/pages/projectOrder/index?tab=1", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                            access: await accessCtrl.getViewOtherSaleLimit(),
                        },
                    ]
                },

            ];
            // 商品    
            this.tabBarList = [
                {
                    id: staticConst.ORDER_XS,
                    // title: lang.saleTxt, //"商品",
                    title: "商品", //"商品",
                    iconOnPath: "/static/images/menuOn01.png",
                    iconPath: "/static/images/menu01.png",
                    path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                    access:
                        (await accessCtrl.getSaleLimit()) ||
                        (await accessCtrl.getGoodsLimit()) || (await accessCtrl.getAboutLimit()),
                    list: [
                        {
                            id: staticConst.MD_GD,
                            title: "产品列表", //"产品",
                            path: "/pages/goods/index",
                            access:
                                (await accessCtrl.getSaleLimit()) ||
                                (await accessCtrl.getGoodsLimit()),
                        },
                        // {
                        //     id: 9999,
                        //     title: "产品列表2",
                        //     path: "/pages/goodsV3/index",
                        //     access: 9999,
                        // },
                        {
                            id: staticConst.YY_XM,
                            title: "服务列表", //"服务",
                            path: "/pages/project/index",
                            access: await accessCtrl.getAboutLimit(),
                        },
                        {
                            id: 5819,
                            title: "卡项列表", //"服务",
                            path: "/pages/cardManagement/index",
                            access: await accessCtrl.getAboutLimit(),
                        },

                        // {
                        //     type: "xs",
                        //     id: staticConst.MD_KD,
                        //     // title: lang.receiptTxt.titleTxt,
                        //     title: "开单",
                        //     path: "/pages/receipt/index",
                        //     access:
                        //         (await accessCtrl.getSaleLimit()) &&
                        //         (await accessCtrl.getBillLimit()),
                        // },
                        // {
                        //     id: staticConst.MD_KH,
                        //     title: lang.customerTxt.titleTxt, //"客户",
                        //     path: "/pages/customer/index",
                        //     access: await accessCtrl.getLimitSeeCustomer(),
                        // },

                        // {
                        //     id: staticConst.MD_DJ,
                        //     title: lang.billTxt.titleTxt,
                        //     path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                        //     access: await accessCtrl.getSaleLimit(),
                        //     list: [
                        //         {
                        //             id: staticConst.MD_DJ_YD, //: 401,云店单
                        //             title: "云店单",
                        //             path: "/pages/saleBills/index?tab=1",
                        //         },
                        //         {
                        //             id: staticConst.MD_DJ_XS, //: 402, //确认单
                        //             title: "销售单",
                        //             path: "/pages/saleBills/index?tab=2",
                        //         },
                        //         {
                        //             id: staticConst.MD_DJ_TH, //: 403, //草稿单
                        //             title: "退货单",
                        //             path: "/pages/saleBills/index?tab=20",
                        //         },
                        //         {
                        //             id: staticConst.MD_DJ_CG, //: 404, //已作废
                        //             title: "草稿单",
                        //             path: "/pages/saleBills/index?tab=21",
                        //         },
                        //         {
                        //             id: staticConst.MD_DJ_ZF, //: 405, //已作废
                        //             title: "已作废",
                        //             path: "/pages/saleBills/index?tab=22",
                        //         },
                        //     ],
                        // },
                    ],
                },
            ];
            // 库存    
            this.tabBarPuschList = [
                {
                    id: staticConst.ORDER_CG,
                    title: lang.purchcaseTxt, //"库存",
                    iconOnPath: "/static/images/c02On.png",
                    iconPath: "/static/images/c02.png",
                    path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                    access: await accessCtrl.getPurchViewQtyEditLimit(),
                    list: [
                        {
                            id: staticConst.CG_KC,
                            title: lang.stockTxt.titleTxt, //"库存",
                            path: "/pages/stock/index",
                            access: await accessCtrl.getPurchViewQtyEditLimit(),
                        },

                        {
                            id: staticConst.CG_GYS,
                            title: lang.supplierTxt.titleTxt, //"供应商",
                            path: "/pages/supplier/index",
                            access: await accessCtrl.getPurchViewSupplierLimit(),
                        },

                        {
                            id: staticConst.CG_KD,
                            title: lang.purchase.titleTxt, //"采购开单",
                            path: "/pages/purchase/index",
                            access:
                                (await accessCtrl.getPurchLimit()) &&
                                (await accessCtrl.getPurchWriteBillLimit()),
                        },
                        {
                            id: staticConst.CG_DJ, //采购单据
                            title: lang.billTxt.titleTxt,
                            path: "/pages/purchBill/index?tab=2", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                            access: await accessCtrl.getPurchLimit(),
                            // list: [
                            //     {
                            //         id: staticConst.CG_DJ_CG, //: 601, //采购单据
                            //         title: "采购单",
                            //         path: "/pages/purchBill/index?tab=2",
                            //     },
                            //     {
                            //         id: staticConst.CG_DJ_TH, //: 602, //退货单据
                            //         title: "退货单",
                            //         path: "/pages/purchBill/index?tab=20",
                            //     },
                            //     {
                            //         id: staticConst.CG_DJ_CG_F, //: 603, //草稿单据
                            //         title: "草稿单",
                            //         path: "/pages/purchBill/index?tab=21",
                            //     },
                            //     {
                            //         id: staticConst.CG_DJ_ZF, //: 604, //作废单据
                            //         title: "已作废",
                            //         path: "/pages/purchBill/index?tab=22",
                            //     },
                            // ],
                        },

                    ],
                },
            ];
            // 库管 
            this.tabBarWarehouseManageList = [
                {
                    id: accessCtrl.LIMIT_STOREKEEEPER,
                    title: '库管',
                    iconOnPath: "/static/images/sale_icon_active1.png",
                    iconPath: "/static/images/sale_icon1.png",
                    path: "",
                    access: (await accessCtrl.getStorekeeperLimit() && await accessCtrl.getStorekeeperViewLimit()),
                    list: [
                        {
                            id: accessCtrl.LIMIT_STOREKEEEPER_DOCUMENT,
                            title: "单据",
                            path: "",
                            access: await accessCtrl.getStorekeeperDocumentLimit(),
                            list: [
                                {
                                    id: accessCtrl.LIMIT_STOREKEEEPER_CODE_OUT,
                                    title: "出库单",
                                    path: "/pages/warehouseManage/orderReceipt/outWarehouse",
                                    access: true,
                                },
                                {
                                    id: accessCtrl.LIMIT_STOREKEEEPER_CODE_INTO,
                                    title: "入库单",
                                    path: "/pages/warehouseManage/orderReceipt/intoWarehouse",
                                    access: true,
                                },
                                {
                                    id: accessCtrl.LIMIT_STOREKEEEPER_CODE_TRANSFER,
                                    title: "调拨单",
                                    path: "/pages/warehouseManage/orderReceipt/transferWarehouse",
                                    access: true,
                                },
                            ],
                        },
                        {
                            id: accessCtrl.LIMIT_STOREKEEEPER_TODO,
                            title: "待办", //项目/预约
                            path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                            access: await accessCtrl.getStorekeeperTodoLimit(),
                            list: [
                                {
                                    id: accessCtrl.LIMIT_STOREKEEEPER_TODO_OUT,
                                    title: "待出库",
                                    path: "/pages/warehouseManage/toDo/toDooutWarehouse",
                                    access: true,
                                },
                                {
                                    id: accessCtrl.LIMIT_STOREKEEEPER_TODO_INTO,
                                    title: "待入库",
                                    path: "/pages/warehouseManage/toDo/toDointoWarehouse",
                                    access: true,
                                },
                                {
                                    id: accessCtrl.LIMIT_STOREKEEEPER_TODO_TRANSFER,
                                    title: "待调拨",
                                    path: "/pages/warehouseManage/toDo/toDotransferWarehouse",
                                    access: true,
                                },
                            ],
                        },
                        {
                            id: accessCtrl.LIMIT_STOREKEEEPER_WAREHOUSE,
                            title: "仓库",
                            path: "",
                            access: await accessCtrl.getStorekeeperWarehouseLimit(),
                            list: [
                                {
                                    id: accessCtrl.LIMIT_STOREKEEEPER_WAREHOUSE_KUCUN,
                                    title: "库存",
                                    path: "/pages/warehouseManage/warehouse/shopStock",
                                    access: true,
                                },
                                {
                                    id: accessCtrl.LIMIT_STOREKEEEPER_WAREHOUSE_CANGKU,
                                    title: "仓库",
                                    path: "/pages/warehouseManage/warehouse/warehouse",
                                    access: true,
                                },
                            ],
                        },
                    ],
                },
            ];
            // 设备    
            this.tabBarDeviceList = [
                {
                    id: accessCtrl.LIMIT_DEV_DEVICE,
                    title: '设备',
                    iconOnPath: "/static/images/stock_icon_active1.png",
                    iconPath: "/static/images/stock_icon1.png",
                    path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                    access: await accessCtrl.getLimitdevDevice(),
                    list: [
                        {
                            id: accessCtrl.LIMIT_DEV_DEVICE_LIST,
                            title: "设备列表", //预约
                            path: "/pages/device/device/index",
                            access: true,
                        },
                        {
                            id: accessCtrl.LIMIT_DEV_DEVICE_SET,
                            title: "开机次数",
                            path: "/pages/device/setDevStartup/index",
                            access: true,
                        },
                        // {
                        //     id: staticConst.CUSTOMER,
                        //     title: "客户列表", 
                        //     path: "/pages/customerV3/customer/index",
                        //     access: (await accessCtrl.getLimitReprot()) && (await accessCtrl.getLimitSaleReport()),
                        // },
                    ]
                },
            ];
            // 采购
            this.marketingList = [
                {
                    id: staticConst.ORDER_CG,
                    title: lang.purchcaseTxt,
                    iconOnPath: "/static/images/menuOn09.png",
                    iconPath: "/static/images/menu09.png",
                    path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                    access: await accessCtrl.getMarketingLimit(),
                    list: [
                        {
                            id: staticConst.CG_KC,
                            title: lang.stockTxt.titleTxt,
                            path: "/pages/stock/index",
                            access: await accessCtrl.getMarketingLimit(),
                        },
                        {
                            id: staticConst.CG_GYS,
                            title: lang.supplierTxt.titleTxt,
                            path: "/pages/supplier/index",
                            access: await accessCtrl.getMarketingLimit(),
                        },
                        {
                            id: staticConst.CG_KD,
                            title: lang.purchase.titleTxt, //"采购开单",
                            path: "/pages/purchase/index",
                            access: true,
                        },
                        {
                            id: staticConst.CG_DJ, //采购单据
                            title: lang.billTxt.titleTxt,
                            path: "/pages/purchBill/index?tab=2", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                            access: await accessCtrl.getPurchLimit(),
                        },

                    ],
                },
            ]
            // 互动
            this.tabBarInteractionList = [
                {
                    id: staticConst.HD_TAB,
                    title: "互动",
                    iconOnPath: "/static/images/interact_01_act.png",
                    iconPath: "/static/images/interact_01.png",
                    path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                    access: await accessCtrl.getLimitInterActive(),
                    list: [
                        {
                            id: staticConst.HD_HDZX,
                            title: "活动中心",
                            path: "/pages/interactiveActivity/business-promotion?cat_id=1",
                            access: true,
                            list: [],
                        },
                        {
                            id: staticConst.HD_GLZX,
                            title: "管理中心",
                            path: "",
                            access: true,
                            list: [
                                {
                                    id: staticConst.HD_WDHD,
                                    title: "我的活动",
                                    path: "/pages/interactiveOrder/my-activities",
                                    access: true,
                                },
                                {
                                    id: staticConst.HD_HXGL,
                                    title: "核销管理",
                                    path: "/pages/interactiveOrder/order-write",
                                    access: true,
                                },
                            ],
                        },
                    ],
                },
            ];
            // 财务
            this.financeList = [
                {
                    id: staticConst.CW,
                    title: "财务",
                    iconOnPath: "/static/images/menuOn08.png",
                    iconPath: "/static/images/menu08.png",
                    path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                    // access: true,
                    access: await accessCtrl.getLimitFinanceAccount(),
                    list: [
                        {
                            id: staticConst.CW_SK,
                            title: "收款",
                            path: "/pages/finance/collections",
                            // access: true,
                            access: await accessCtrl.getLimitFinanceCollerction(),
                        },
                        {
                            id: staticConst.CW_FK,
                            title: "付款",
                            path: "/pages/finance/payment",
                            // access: true,
                            access: await accessCtrl.getLimitFinanceCollerction(),
                        },
                    ]
                }
            ]
            // 营销
            this.tabMarketingList = [
                {
                    id: staticConst.YX_PT,
                    title: "营销",
                    iconOnPath: "/static/images/menuOn09.png",
                    iconPath: "/static/images/menu09.png",
                    path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                    // access: true,
                    access: await accessCtrl.getMarketingLimit(),
                    list: [
                        {
                            id: accessCtrl.LIMIT_MARKETING_EXTNSION,
                            title: "推广",
                            path: "",
                            access: await accessCtrl.getLimitMarketingExtension(),
                            list: [
                                {
                                    id: accessCtrl.LIMIT_MARKETING_SAOMAO_ORDER,
                                    title: "扫码下单",
                                    path: "/pages/scanCodeToOrder/index",
                                    access: true,
                                    // access: await accessCtrl.getLimitMarketingScanCodeOrder(),
                                },
                                {
                                    id: accessCtrl.LIMIT_MARKETING_SIGNIN,
                                    title: "会员签到",
                                    path: "/pages/signIn/index",
                                    access: await accessCtrl.getLimitMarketingSignIn(),
                                },
                            ]
                        },
                        {
                            id: staticConst.YX_PT,
                            title: "活动",
                            path: "",
                            access: await accessCtrl.getMarketingLimit(),
                            list: [
                                {
                                    id: accessCtrl.LIMIT_MARKETING_TP_BM,
                                    title: "投票/报名",
                                    path: "/pages/marketingTpBm/index",
                                    access: await accessCtrl.getLimitMarketingTpBm(),
                                },
                                {
                                    id: accessCtrl.LIMIT_MARKETING_SECKILL,
                                    title: "限时秒杀",
                                    path: "/pages/timeLimitseckill/index",
                                    access: await accessCtrl.getLimitMarketingTimeLimitSeckill(),
                                },
                                {
                                    id: accessCtrl.LIMIT_MARKETING_DOUGH,
                                    title: "拼团优惠",
                                    path: "/pages/timeLimitsecGroup/index",
                                    access: await accessCtrl.getLimitMarketingTimeLimitGroup(),
                                },
                                {
                                    id: accessCtrl.LIMIT_MARKETING_DISCOUNT,
                                    title: "限时优惠",
                                    path: "/pages/timeLimitsecOffer/index",
                                    access: await accessCtrl.getLimitMarketingTimeLimitDiscount(),
                                },
                                {
                                    id: accessCtrl.LIMIT_MARKETING_DISTRIBUTION,
                                    title: "分销有礼",
                                    path: "/pages/distrGifts/index",
                                    access: await accessCtrl.getLimitMarketingDistrGifts(),
                                },
                                {
                                    id: accessCtrl.LIMIT_MARKETING_RECHARGE,
                                    title: "充值有礼",
                                    path: "/pages/rechargeGifts/index",
                                    access: await accessCtrl.getLimitMarketingRechargeGifts(),
                                },
                                {
                                    id: accessCtrl.LIMIT_MARKETING_INTEGRAL,
                                    title: "积分体系",
                                    path: "/pages/pointsGifts/index",
                                    access: await accessCtrl.getLimitMarketingPointsGifts(),
                                },
                            ]
                        },
                        {
                            id: accessCtrl.LIMIT_MARKETING_GRADE,
                            title: "会员体系",
                            path: "",
                            access: await accessCtrl.getLimitMarketingMemberLevel(),
                            list: [
                                {
                                    id: accessCtrl.LIMIT_MARKETING_GRADE,
                                    title: "会员等级",
                                    path: "/pages/memberLevel/index",
                                    access: await accessCtrl.getLimitMarketingMemberLevel(),
                                },
                            ]
                        },
                        {
                            id: staticConst.HD_TAB,
                            title: "互动",
                            // iconOnPath: "/static/images/interact_01_act.png",
                            // iconPath: "/static/images/interact_01.png",
                            path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                            access: await accessCtrl.getLimitInterActive(),
                            list: [
                                {
                                    id: staticConst.HD_HDZX,
                                    title: "活动中心",
                                    path: "/pages/interactiveActivity/business-promotion?cat_id=1",
                                    access: true,
                                    list: [],
                                },
                                {
                                    id: staticConst.HD_WDHD,
                                    title: "我的活动",
                                    path: "/pages/interactiveOrder/my-activities",
                                    access: true,
                                },
                                {
                                    id: staticConst.HD_HXGL,
                                    title: "核销管理",
                                    path: "/pages/interactiveOrder/order-write",
                                    access: true,
                                },
                            ],
                        },
                    ]
                }
            ];
            // 同城商圈
            this.tabBarLocalbusiness = [
                {
                    id: staticConst.TCSQ_TAB,
                    title: "同城商圈",
                    iconOnPath: "/static/images/interact_01_act.png",
                    iconPath: "/static/images/interact_01.png",
                    path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                    access: true,
                    list: [
                        {
                            id: staticConst.TCSQ_BB,
                            title: "报表",
                            path: "",
                            access: true,
                            list: [
                                {
                                    id: staticConst.TCSQ_BB_XX,
                                    title: "销售",
                                    path: "/pages/businessDistrict/saleReport?tab=1",
                                },
                                {
                                    id: staticConst.TCSQ_BB_TJ,
                                    title: "统计",
                                    path: "/pages/businessDistrict/saleReport?tab=2",
                                },
                            ],
                        },
                        // {
                        //     id: staticConst.HD_GLZX,
                        //     title: "管理中心",
                        //     path: "",
                        //     access: true,
                        //     list: [
                        //         {
                        //             id: staticConst.HD_WDHD,
                        //             title: "我的活动",
                        //             path: "/pages/interactiveOrder/my-activities",
                        //         },
                        //         {
                        //             id: staticConst.HD_HXGL,
                        //             title: "核销管理",
                        //             path: "/pages/interactiveOrder/order-write",
                        //         },
                        //     ],
                        // },
                    ],
                },
            ];
            // 销售报表
            this.tabBarReportList = [
                {
                    id: staticConst.REP_ALL,
                    title: lang.repTxt, //"销售报表",
                    iconOnPath: "/static/images/sale_icon_active1.png",
                    iconPath: "/static/images/sale_icon1.png",
                    path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                    access: await accessCtrl.getLimitReprot(),
                    list: [
                        {
                            id: staticConst.REP_XS,
                            title: "销售报表",
                            path: "/pages/report/saleReport",
                            access: await accessCtrl.getLimitSaleReport(), //  (await accessCtrl.getLimitReprot()) && (await accessCtrl.getLimitSaleReport())
                        },
                        {
                            id: staticConst.REP_YY,
                            title: "项目/预约", //项目/预约
                            path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                            access: await accessCtrl.getLimitSubscribeReprot(),
                            list: [
                                {
                                    id: staticConst.REP_YY_XM, //: 1701, //服务
                                    title: "项目报表",
                                    path: "/pages/report/appointment",
                                    access: true
                                },
                                {
                                    id: staticConst.REP_YY_YY, //: 1702, //预约
                                    title: "预约报表",
                                    path: "/pages/report/yuyue",
                                    access: true
                                },
                            ],
                        },
                        {
                            id: staticConst.REP_CG, //采购报表
                            title: lang.report.repPurchTxt,
                            path: "", //有子菜单这个路径不用填写，会去找下级子菜单，填写了就不会找下级子菜单
                            access: await accessCtrl.getLimitPurchReport(),
                            list: [
                                {
                                    id: staticConst.REP_CG_CG, //: 901, //采购
                                    title: "采购报表",
                                    path: "/pages/report/purchaseReport", // ?tab=1
                                    access: true
                                },
                                {
                                    id: staticConst.REP_CG_CK, //: 902, //仓库
                                    title: "仓库报表",
                                    path: "/pages/report/warehouse",
                                    access: true
                                },
                                {
                                    id: staticConst.REP_CG_CK_F, //: 903, //出库
                                    title: "出库报表",
                                    path: "/pages/report/outBound",
                                    access: true
                                },
                                {
                                    id: staticConst.REP_CG_RK, //: 904, //人库
                                    title: "入库报表",
                                    path: "/pages/report/intoBound",
                                    access: true
                                },
                            ],
                        },
                        {
                            id: staticConst.REP_TJ, //统计报表
                            title: lang.report.repStockTxt,
                            path: "/pages/report/statisticalReport?tab=1",
                            access: await accessCtrl.getLimitStockReport(),
                            list: [],
                        },
                    ],
                },
            ];
            this.getactivityCatFun();
        },

        // 获取活动导航列表
        async getactivityCatFun() {
            // let url = config.HD_TOOL_CAT_LS;
            // let param = {};
            // let res = await this.$api({ url: url, data: param });
            // if (!res) return;
            // if (res.status == 1 && res.data.cat_ls) {
            //     res.data.cat_ls.map((v) => {
            //         if (v.id == 1) {
            //             //商业促销
            //             v.path = `/pages/interactiveActivity/business-promotion?cat_id=${v.id}`;
            //         }
            //     });
            //     this.tabBarInteractionList[0].list.map((v) => {
            //         if (v.id == staticConst.HD_HDZX) {
            //             v.list = res.data.cat_ls;
            //         }
            //     });
            // }
            this.init();
        },

        /****产品开单，供应商开单****/
        bill(type) {
            let item = {};
            if (type == 1) {
                item = this.billingList[0];
            } else {
                item = this.billingList[0];
            }
            this.goPath(item);
        },

        /****服务开单*****/
        projectBill() {
            this.tabIndex = staticConst.YY_ADD_GOODS;
            this.curSecondId = staticConst.YY_YY;
            let item = this.tabBarAboutList[0].list[2];
            this.clickTirthd(item, item.list[2]);
        },

        /*****服务客户****/
        projectCustomer(name) {
            this.tabIndex = staticConst.YY_ADD_GOODS;
            this.curThirdId = -1;
            let item = this.tabBarAboutList[0].list[1];
            let temp = JSON.parse(JSON.stringify(item));
            temp.path = temp.path + "?customerName=" + name;
            this.clickSecond(temp);
        },

        /*****产品*****/
        goods() {
            let item = this.tabBarList[0];
            this.goPath(item);
        },

        // 菜单跳转路由
        goPath(item) {
            console.log("goPath数据==", this.tabIndex, item);
            if (this.tabIndex == item.id) return;
            this.tabIndex = item.id;
            uni.setLeftWindowStyle({ width: "240px" }); //设置左边导航宽度
            this.sTitleTxt = item.title;
            this.secondList = item.list;
            this.expander = true;
            this.$store.commit("setIsExpand", this.expander);
            if (this.secondList && this.secondList.length > 0) {
                let temp = this.secondList[0];
                this.clickSecond(temp);
            }
            this.showArrowBtn = true;
            this.init();
        },

        /****点击二级导航***/
        clickSecond(item) {
            if (this.curSecondId == item.id) return;
            this.curSecondId = item.id;
            if (item.path) {
                this.curThirdId = -1;
                goPage.goNavTo(item.path);
                this.setLocalStore();
            } else {
                if (item.list && item.list.length > 0) {
                    this.clickTirthd(item, item.list[0]);
                }
            }
        },

        /****点击三级级导航***/
        clickTirthd(pItem, item) {
            this.curSecondId = pItem.id;
            if (this.curThirdId == item.id) return;
            this.curThirdId = item.id;
            if (item.path) {
                goPage.goNavTo(item.path);
                this.setLocalStore();
            }
        },
        /***打开/关闭设置菜单**/
        openSetWin(item) {
            this.$refs.sysMenu.dialogVisible = true;
            this.$refs.sysMenu.initData();
            return;
            // if(this.tabIndex == staticConst.YY_ADD_GOODS) {
            // 	uni.setLeftWindowStyle({ width: "72px" }); //设置左边导航宽度
            // 	this.showArrowBtn = true;
            // 	this.expander = false;
            // 	this.$store.commit('setIsExpand',this.expander);
            // }
            //          if (item.id == 1 || item.id == staticConst.YX_YX)
            // {
            // 	// this.$emit("openSetWin", item.id);
            // 	uni.$emit("openSetWin", item.id);
            // }

            //          if (item.id == 2) this.$emit("openVip", item);
        },

        /****添加新的客户****/
        addNewCustom() {
            let item = this.tabBarList[1];
            this.goPath(item);
        },

        toggleSecond(index, item) {
            if (this.activeSecondIndex === index) {
                this.activeSecondIndex = null;
            } else {
                this.activeSecondIndex = index;
                this.curSecondId = item.id;
                // 如果没有三级菜单，直接高亮并跳转
                if (!item.list || item.list.length === 0) {
                    this.curThirdId = -1;
                    if (item.path) {
                        goPage.goNavTo(item.path);
                        this.setLocalStore();
                    }
                }
            }
        },
        handleMenuClick(second, third) {
            if (third && second.list && second.list.length > 0) {
                this.curSecondId = second.id;
                this.curThirdId = third.id;
                if (third.path) {
                    this.setLocalStore();
                    goPage.goNavTo(third.path);
                }
            } else {
                if (second.list && second.list.length > 0) {
                    return;
                }
                this.curThirdId = -1;
                this.curSecondId = second.id;
                if (second.path) {
                    goPage.goNavTo(second.path);
                    this.setLocalStore();
                }
            }
        },
        syncMenuActiveByRoute() {
            const path = this.$route?.path || location.hash.replace(/^#/, '');
            for (let i = 0; i < this.secondList.length; i++) {
                const second = this.secondList[i];
                if (second.path && second.path.indexOf(path) > -1) {
                    this.curSecondId = second.id;
                    this.curThirdId = -1;
                    return;
                }
                if (second.list) {
                    for (let j = 0; j < second.list.length; j++) {
                        const third = second.list[j];
                        if (third.path && third.path.indexOf(path) > -1) {
                            this.curSecondId = second.id;
                            this.curThirdId = third.id;
                            return;
                        }
                    }
                }
            }
        },
        goSetting() {
            this.tabIndex = null
            this.showArrowBtn = false
            let data = {};
            data.tabIndex = "9999";
            data.curSecondId = "9999";
            data.curThirdId = "9999";
            goPage.goNavTo('/pages/setting/module/accSecury');
            this.$store.commit("setTabBarIds", data);
        },
    },
};
</script>
<style lang="scss">
.tabbar {
    height: 100vh;
    width: 239px;
    // position: fixed;
    display: flex;
    border-right: 1px solid #ececec;

    .tabbar-box {
        width: 72px;
        position: fixed;
        top: 0;
        left: 0;
        display: flex;
        flex-wrap: wrap;
        align-content: space-between;

        justify-content: center;
        background: #292f4c; //3388FF//$uni-color-primary;
        // background: linear-gradient(120deg , rgba(177,62,240,.8) , rgba(112,81,248,.8));
        height: 100%;
        width: 72px;
        z-index: 999;

        .tabbar-top {
            margin-top: 20px;

            .logo-img {
                width: 40px;
                height: 40px;
                border-radius: 50%;
                overflow: hidden;

                image {
                    width: 100%;
                    height: 100%;
                }
            }

            .box-type {
                height: calc(100vh - 140px);
                overflow: auto;
                overflow-y: scroll;
                scrollbar-color: transparent transparent;
                scrollbar-track-color: transparent;
                -ms-scrollbar-track-color: transparent;

                &.comm-list {}

                .type-txt {
                    color: #6a6e82;
                    text-align: center;
                    padding-top: 0px;
                    font-size: 14px;
                    // padding-left: 3px;
                }

                .type-txt-s {
                    color: #3388ff;
                }

                .type-txt-t10 {
                    padding-top: 0px;
                }

                .item {
                    margin-top: 14px;
                    text-align: center;
                    width: 32px;
                    // height: 40px;
                    padding-left: 4px;
                    color: #fff; //rbga(255,255,255,1);
                    cursor: pointer;
                    position: relative;

                    .i-icon {
                        width: 32px;
                        height: 32px;
                        color: #fff;

                        image {
                            width: 100%;
                            height: 100%;
                        }
                    }

                    .i-icon:hover {
                        opacity: 0.8;
                    }
                }

                .active {
                    color: #3388ff;
                }

                .item:hover {
                    &.active {
                        color: #3388ff;
                    }

                    color: #3388ff;
                }
            }
        }

        .tabber-set {
            width: 100%;
            text-align: center;

            margin-bottom: 0px;
            color: #fff;
            cursor: pointer;
            flex-wrap: wrap;
            align-items: center;
            justify-content: center;

            .item {
                margin-top: 20px;
                text-align: center;
                width: 32px;
                height: 50px;
                padding-left: 20px;
                color: #fff; //rbga(255,255,255,1);
                cursor: pointer;

                .i-icon {
                    width: 32px;
                    height: 32px;

                    image {
                        width: 100%;
                        height: 100%;
                    }
                }

                .i-icon:hover {
                    opacity: 0.8;
                }
            }
        }
    }

    .c-list {
        box-sizing: border-box;
        width: 165px;
        margin-left: 72px;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
        padding: 10px 0 20px 0;

        .group-title {
            box-sizing: border-box;
            font-size: 16px;
            font-weight: 600;
            padding: 0 20px;
            margin-bottom: 2px;
            letter-spacing: 1px;
        }

        .divider {
            height: 1px;
            background: #f0f0f0;
            margin: 8px 0;
            width: 100%;
        }

        .item {
            margin: 0 0 2px 0;
            border-radius: 6px;
            transition: background 0.2s;
            cursor: pointer;

            .i-tit {
                padding: 8px 20px;
                font-size: 15px;
                color: #333;
                border-radius: 6px;
                display: flex;
                align-items: center;
                transition: background 0.2s, color 0.2s;
                position: relative;
                box-sizing: border-box;
                font-weight: 500;
            }

            .i-tit-act,
            .i-tit:hover {
                background: #f3f8ff;
                color: #3388ff;
                font-weight: 600;
            }

            .i-tit-act::before {
                content: '';
                position: absolute;
                left: 10px;
                top: 8px;
                bottom: 8px;
                width: 3px;
                border-radius: 2px;
                background: #3388ff;
            }

            .third-list {
                margin-left: 6px;
                border-left: 2px solid #f0f0f0;
                padding-left: 6px;
            }

            .item-s {
                padding: 6px 18px;
                font-size: 14px;
                color: #666;
                border-radius: 4px;
                margin: 2px 0;
                transition: background 0.2s, color 0.2s;
                position: relative;
            }

            .item-s-act,
            .item-s:hover {
                background: #eaf3ff;
                color: #3388ff;
                font-weight: 600;
            }

            .item-s-act::before {
                content: '';
                position: absolute;
                left: 8px;
                top: 8px;
                bottom: 8px;
                width: 2px;
                border-radius: 1px;
                background: #3388ff;
            }
        }
    }

    .arrow-box {
        z-index: 999;
        position: absolute;
        right: 0px;
        top: calc(50% - 25px);

        .a-b-com {
            height: 50px;
            width: 12px;
            background-color: #ececec;
            cursor: pointer;

            .arrow {
                line-height: 50px;
                text-align: center;
            }
        }

        .a-b-com:hover {
            color: #fff;
            background-color: #3388ff;
        }

        .a-b-l {
            border-top-rigth-radius: 3px;
            border-bottom-rigth-radius: 3px;
        }

        .a-b-r {
            border-top-left-radius: 3px;
            border-bottom-left-radius: 3px;
        }
    }
}
</style>

<style lang="scss" scoped>
.comm-list::-webkit-scrollbar-thumb {
    /*滚动条里面小方块*/
    border-radius: 4px;
    -webkit-box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0);
    scrollbar-arrow-color: red;
}
</style>